package cn.chengpengper.im.platform.common.exception;

import cn.chengpengper.im.platform.common.model.enums.HttpCode;
import lombok.Getter;

/*@formatter:off*/

/**
 * ____________________
 * < 神兽护体，永无bug! >
 * --------------------
 *
 * @author huchengpeng
 * @version v1.0.0
 * @date 2024/11/23 17:05
 * @description 自定义异常
 */

/*@formatter:on*/

@Getter
public class ImException extends RuntimeException {

    private static final long serialVersionUID = 8495304981985419941L;

    private Integer code;

    private String message;

    public ImException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ImException(HttpCode httpCode, String message) {
        this.code = httpCode.getCode();
        this.message = message;
    }

    public ImException(HttpCode httpCode) {
        this.code = httpCode.getCode();
        this.message = httpCode.getMsg();
    }

    public ImException(String message) {
        this.code = HttpCode.PROGRAM_ERROR.getCode();
        this.message = message;
    }

}
